//
//  SNBpView.m
//  project
//
//  Created by 黄建华 on 2017/12/12.
//  Copyright © 2017年 黄建华. All rights reserved.
//

#import "SNBpView.h"
#define SNBPSBP [UIColor colorFromHex:0xe66490]
#define SNBPDBP [UIColor colorFromHex:0x65d4fe]
@implementation SNBpView

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self performSelector:@selector(createChartView) withObject:nil afterDelay:IOSINITWAITTIME];
    }
    return self;
}

- (void)createChartView {
    self.backgroundColor = [UIColor whiteColor];
    
    UIView *sbpView = [[UIView alloc] init];
    sbpView.frame           = SNFRAME(1.5, 0, 2, self.height /2);
    sbpView.backgroundColor = SNBPSBP;
    [self addSubview:sbpView];
    
    UIView *dbpView = [[UIView alloc] init];
    dbpView.frame           = SNFRAME(1.5, self.height /2, 2, self.height /2);
    dbpView.backgroundColor = SNBPDBP;
    [self addSubview:dbpView];
    
    UIView *sbpDot = [[UIView alloc] init];
    sbpDot.frame               = SNFRAME(0, -2, 5, 5);
    sbpDot.backgroundColor     = SNBPSBP;
    sbpDot.layer.cornerRadius  = 2.5;
    sbpDot.layer.masksToBounds = YES;
    [self addSubview:sbpDot];
    
    UIView *dbpDot = [[UIView alloc] init];
    dbpDot.frame               = SNFRAME(0, +self.height, 5, 5);
    dbpDot.backgroundColor     = SNBPDBP;
    dbpDot.layer.cornerRadius  = 2.5;
    dbpDot.layer.masksToBounds = YES;
    [self addSubview:dbpDot];
}

@end

